package oldrouter.gui.messageSender;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import oldrouter.Router;


import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

public class MessageSender extends JPanel {
	private static final long serialVersionUID = -4085487932901853742L;
	private JTextField textFieldSource;
	private JTextField textFieldDest;
	private JTextField textFieldNum;
	private JTextField textFieldCont;
	
	
	
	public MessageSender(Router router) {
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWeights = new double[]{0,1};
		gridBagLayout.rowWeights = new double[]{0,0,0,0,0,0};
		setLayout(gridBagLayout);
		
		
		JLabel lblSource = new JLabel("Source");
		GridBagConstraints gbc_lblSource = new GridBagConstraints();
		gbc_lblSource.anchor = GridBagConstraints.EAST;
		gbc_lblSource.insets = new Insets(0, 0, 5, 5);
		gbc_lblSource.gridx = 0;
		gbc_lblSource.gridy = 0;
		add(lblSource, gbc_lblSource);
		
		textFieldSource = new JTextField();
		GridBagConstraints gbc_textFieldSource = new GridBagConstraints();
		gbc_textFieldSource.insets = new Insets(0, 0, 5, 0);
		gbc_textFieldSource.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldSource.gridx = 1;
		gbc_textFieldSource.gridy = 0;
		add(textFieldSource, gbc_textFieldSource);
		textFieldSource.setColumns(10);
		
		JLabel lblDestination = new JLabel("Destination");
		GridBagConstraints gbc_lblDestination = new GridBagConstraints();
		gbc_lblDestination.anchor = GridBagConstraints.EAST;
		gbc_lblDestination.insets = new Insets(0, 0, 5, 5);
		gbc_lblDestination.gridx = 0;
		gbc_lblDestination.gridy = 1;
		add(lblDestination, gbc_lblDestination);
		
		textFieldDest = new JTextField();
		GridBagConstraints gbc_textFieldDest = new GridBagConstraints();
		gbc_textFieldDest.insets = new Insets(0, 0, 5, 0);
		gbc_textFieldDest.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldDest.gridx = 1;
		gbc_textFieldDest.gridy = 1;
		add(textFieldDest, gbc_textFieldDest);
		textFieldDest.setColumns(10);
		
		JLabel lblNumro = new JLabel("Num\u00E9ro");
		GridBagConstraints gbc_lblNumro = new GridBagConstraints();
		gbc_lblNumro.anchor = GridBagConstraints.EAST;
		gbc_lblNumro.insets = new Insets(0, 0, 5, 5);
		gbc_lblNumro.gridx = 0;
		gbc_lblNumro.gridy = 2;
		add(lblNumro, gbc_lblNumro);
		
		textFieldNum = new JTextField();
		GridBagConstraints gbc_textFieldNum = new GridBagConstraints();
		gbc_textFieldNum.insets = new Insets(0, 0, 5, 0);
		gbc_textFieldNum.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldNum.gridx = 1;
		gbc_textFieldNum.gridy = 2;
		add(textFieldNum, gbc_textFieldNum);
		textFieldNum.setColumns(10);
		
		JCheckBox chckbxContenu = new JCheckBox("Contenu");
		GridBagConstraints gbc_chckbxContenu = new GridBagConstraints();
		gbc_chckbxContenu.insets = new Insets(0, 0, 5, 5);
		gbc_chckbxContenu.gridx = 0;
		gbc_chckbxContenu.gridy = 3;
		add(chckbxContenu, gbc_chckbxContenu);
		
		textFieldCont = new JTextField();
		GridBagConstraints gbc_textFieldCont = new GridBagConstraints();
		gbc_textFieldCont.insets = new Insets(0, 0, 5, 0);
		gbc_textFieldCont.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldCont.gridx = 1;
		gbc_textFieldCont.gridy = 3;
		add(textFieldCont, gbc_textFieldCont);
		textFieldCont.setColumns(10);
		
		JCheckBox chckbxAck = new JCheckBox("Accus\u00E9 de r\u00E9ception");
		GridBagConstraints gbc_chckbxAck = new GridBagConstraints();
		gbc_chckbxAck.anchor = GridBagConstraints.WEST;
		gbc_chckbxAck.insets = new Insets(0, 0, 5, 0);
		gbc_chckbxAck.gridwidth = 2;
		gbc_chckbxAck.gridx = 0;
		gbc_chckbxAck.gridy = 4;
		add(chckbxAck, gbc_chckbxAck);
		
		JButton btnSend = new JButton("Envoyer");
		btnSend.setEnabled(false);
		GridBagConstraints gbc_btnSend = new GridBagConstraints();
		gbc_btnSend.anchor = GridBagConstraints.EAST;
		gbc_btnSend.gridx = 1;
		gbc_btnSend.gridy = 5;
		add(btnSend, gbc_btnSend);
	}

}
